<?php $this->Html->script("get_parent_category.js", array('inline' => false)); ?>
<div class="col-md-3">
    <h2><kbd><?php echo __('Actions'); ?></kbd></h2>
    <hr/>
    <ul class="nav  nav-stacked">

        <li><?php echo $this->Html->link(__('List Categories'), array('action' => 'index')); ?></li>
        <li><?php echo $this->Html->link(__('List Users'), array('controller' => 'users', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New User'), array('controller' => 'users', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Categories'), array('controller' => 'categories', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Parent Category'), array('controller' => 'categories', 'action' => 'add')); ?> </li>
        <li><?php echo $this->Html->link(__('List Transactions'), array('controller' => 'transactions', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Transaction'), array('controller' => 'transactions', 'action' => 'add')); ?> </li>
    </ul>
</div>
<div class="categories form col-md-9">
    <?php echo $this->Form->create('Category', array('class' => 'form-horizontal', 'inputDefaults' => array('label' => false))); ?>
    <fieldset>
        <h2><kbd><?php echo __('Add New Category'); ?></kbd></h2>
        <hr/>

        <div class="form-group">
            <label for="userid" class="col-md-3 control-label">User name</label>

            <div class="col-md-2">
                <?php
                echo $this->Form->input('user_id', array('options' => array($currentUser['id'] => $currentUser['username']), 'type' => 'select', 'class' => "form-control"));
                ?>
            </div>
        </div>

        <div class="form-group">
            <label for="namecategory" class="col-md-3 control-label">Name New Category</label>

            <div class="col-md-4">
                <?php
                echo $this->Form->input('name', array('placeholder' => 'Name New Category ...', 'class' => "form-control"));
                ?>
            </div>
        </div>

        <div class="form-group">
            <label for="description" class="col-md-3 control-label">Description</label>

            <div class="col-md-4">
                <?php
                echo $this->Form->input('description', array('placeholder' => 'Description ...', 'class' => "form-control"));
                ?>
            </div>
        </div>


        <div class="form-group">
            <label for="type" class="col-md-3 control-label">Type of Category</label>

            <div class="col-md-4">
                <?php echo $this->Form->input('type', array('options' => array('1' => 'Spent', '2' => 'Earn'), 'class' => "form-control")); ?>
            </div>
        </div>
        <div class="form-group">
            <label for="userid" class="col-md-3 control-label">Parent</label>

            <div class="col-md-3">
                <select id="CategoryParentId" name="data[Category][parent_id]" class="form-control">
                    <option value="0">--No parent--</option>

                    <?php
                    foreach ($parentCategories as $p) {
                        echo '<option value="' . $p['Pcat']['id'] . '">' . $p['Pcat']['name'] . "</option>";
                    }
                    ?>
                </select>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-4 col-md-offset-3">
                <?php echo $this->Form->Submit(__('Submit'), array('class' => ('btn btn-danger'))); ?>
            </div>
        </div>
    </fieldset>
    <?php echo $this->Form->end(); ?>
</div>
